<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>反转消息</title>
</head>

<body>
    <h1>反转消息</h1>
    <div style="color:gray">
        <p>点击[反转消息]按钮后, 让消息反转过来。</p>
        <p>体验使用<code>v-on</code>处理事件。</p>
    </div>
    <div>
        <a href="/">回目录</a>
    </div>
    <hr>
    <div id="app">
        <div>{{message}}</div>
        <div>
            <button v-on:click="reverseMessage">反转消息</button>
        </div>
    </div>
    <script src="/node_modules/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                message: "Hello Vue!"
            },
            methods: {
                reverseMessage: function() {
                    this.message = this.message.split('').reverse().join('');
                }
            }
        });
    </script>
</body>

</html>